/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cl.bussines.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Vogel
 */
@Entity
@Table(name = "rol_has_permisos")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "RolHasPermisos.findAll", query = "SELECT r FROM RolHasPermisos r"),
    @NamedQuery(name = "RolHasPermisos.findByIdRolHasPermisos", query = "SELECT r FROM RolHasPermisos r WHERE r.idRolHasPermisos = :idRolHasPermisos")})
public class RolHasPermisos implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_Rol_Has_Permisos")
    private Integer idRolHasPermisos;
    @JoinColumn(name = "id_Permiso", referencedColumnName = "id_Permiso")
    @ManyToOne(optional = false)
    private Permisos idPermiso;
    @JoinColumn(name = "id_Rol", referencedColumnName = "id_Rol")
    @ManyToOne(optional = false)
    private Rol idRol;

    public RolHasPermisos() {
    }

    public RolHasPermisos(Integer idRolHasPermisos) {
        this.idRolHasPermisos = idRolHasPermisos;
    }

    public Integer getIdRolHasPermisos() {
        return idRolHasPermisos;
    }

    public void setIdRolHasPermisos(Integer idRolHasPermisos) {
        this.idRolHasPermisos = idRolHasPermisos;
    }

    public Permisos getIdPermiso() {
        return idPermiso;
    }

    public void setIdPermiso(Permisos idPermiso) {
        this.idPermiso = idPermiso;
    }

    public Rol getIdRol() {
        return idRol;
    }

    public void setIdRol(Rol idRol) {
        this.idRol = idRol;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idRolHasPermisos != null ? idRolHasPermisos.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RolHasPermisos)) {
            return false;
        }
        RolHasPermisos other = (RolHasPermisos) object;
        if ((this.idRolHasPermisos == null && other.idRolHasPermisos != null) || (this.idRolHasPermisos != null && !this.idRolHasPermisos.equals(other.idRolHasPermisos))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cl.bussines.entities.RolHasPermisos[ idRolHasPermisos=" + idRolHasPermisos + " ]";
    }
    
}
